<?php

namespace Domain\Task;

use Domain\Task\TaskStatus;
use Domain\Task\CalendarDate;

// Entity
class Task {

    private $iID;
    private $sDescription;
    private $oStatus;
    private $oCreationDate;
    private $oDeadline;
    private $oActDate;

    public function __construct($taskId, TaskStatus $taskStatus, \DateTime $creationDate) {
        $this->iID = $taskId;
        $this->oStatus = $oStatus;
        $this->oCreationDate = new CalendarDate($creationDate);
    }

    public function checkOff() {
        $this->oStatus = new TaskStatus('Finished');
    }

    public function getStatus() {
        return $this->oStatus->getCurrentStatus();
    }

    public function setDescription($taskDescription) {
        $this->sDescription = (string) $sDescription;
    }

    public function getDescription() {
        return $this->sDescription;
    }

    public function getCreationDate() {
        return $this->oCreationDate->toString();
    }

    public function setDeadline(\DateTime $taskDeadline) {
        $this->oDeadline = new DeadlineDate($taskDeadline);
    }

    public function getDeadline() {
        return $this->oDeadline->toString();
    }

    public function setActDate(\DateTime $dateToAct) {
        $this->oActDate = new CalendarDate($dateToAct);
    }

    public function getActDate() {
        return $this->oActDate->toString();
    }

}

?>
